package vars

import (
	"gitee.com/csingo/cHelper"
	"gitee.com/csingo/cServer"
)

var ServerConfig = &cServer.ServerConf{
	HttpServer: cServer.ServerConf_HttpServer{
		Enable:         true,
		Debug:          cHelper.EnvToBool("SERVER_HTTP_DEBUG", false),
		Port:           cHelper.EnvToInt("SERVER_HTTP_PORT", 8080),
		ReadTimeout:    cHelper.EnvToInt("SERVER_HTTP_READ_TIMEOUT", 10),
		WriteTimeout:   cHelper.EnvToInt("SERVER_HTTP_WRITE_TIMEOUT", 10),
		IdleTimeout:    cHelper.EnvToInt("SERVER_HTTP_EXIT_TIMEOUT", 10),
		MaxHeaderBytes: cHelper.EnvToInt("SERVER_HTTP_MAX_HEADER", 20),
		Cross: cServer.ServerConf_HttpServer_Cross{
			Enable:           cHelper.EnvToBool("SERVER_HTTP_CROSS_ENABLE", true),
			AllowCredentials: cHelper.EnvToBool("SERVER_HTTP_CROSS_ALLOW_CREDENTIALS", true),
			AllowWebSockets:  cHelper.EnvToBool("SERVER_HTTP_CROSS_ALLOW_WEBSOCKETS", true),
			MaxAge:           int64(cHelper.EnvToInt("SERVER_HTTP_CROSS_MAX_AGE", 86400)),
		},
	},
}
